public class Main {
    public static void main(String[] args) {
//        实现一个方法 sum, 以数组为参数, 求数组所有元素之和.
        int[] arr = new int[]{1,2,3,4,5,6,7,8,9,10};
        int re = sum(arr);
        System.out.println(re);
    }
    public static int sum(int[] a){
        int sum = 0;
        for(int i = 0; i < a.length; i++){
            sum += a[i];
        }
        return sum;
    }
}